home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / portable / noecho.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.5 KB  |  64 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef UNIX
  5. #define NOTLIB
  6. #include <defs.h>
  7. #include <term.h>
  8. #endif
  9. #undef    noecho
  10.  
  11. #ifdef PDCDEBUG
  12. char *rcsid_noecho = "$Header: C:\CURSES\portable\RCS\noecho.c 2.1 1993/06/18 20:20:38 MH Rel MH $";
  13. #endif
  14.  
  15.  
  16.  
  17.  
  18. /*man-start*********************************************************************
  19.  
  20.   noecho()    - enable/disable terminal echo
  21.  
  22.   X/Open Description:
  23.      These functions control whether characters typed by the user
  24.      are echoed by the input routine.  Initially, input characters
  25.      are echoed.  Subsequent calls to echo() and noecho() do not
  26.      flush type-ahead.
  27.  
  28.   PDCurses Description:
  29.      No additional PDCurses functionality.
  30.  
  31.   X/Open Return Value:
  32.      The noraw() function returns OK on success and ERR on error.
  33.  
  34.   X/Open Errors:
  35.      No errors are defined for this function.
  36.  
  37.   Portability:
  38.      PDCurses    int noecho( void );
  39.      X/Open Dec '88    int noecho( void );
  40.      BSD Curses    int noecho( void );
  41.      SYS V Curses    int noecho( void );
  42.  
  43. **man-end**********************************************************************/
  44.  
  45. int    noecho(void)
  46. {
  47. #ifdef PDCDEBUG
  48.     if (trace_on) PDC_debug("noecho() - called\n");
  49. #endif
  50.  
  51. #ifdef UNIX
  52. #ifdef USE_TERMIO
  53.     _CUR_TERM.prog_mode.c_lflag &= ~(ECHO|ECHOPRT);
  54.     ioctl(_CUR_TERM.fd, TCSETAW, &_CUR_TERM.prog_mode);
  55. #else
  56.     _CUR_TERM.prog_mode.sg_flags &= ~ECHO;
  57.     ioctl(_CUR_TERM.fd, TIOCSETP, &_CUR_TERM.prog_mode);
  58. #endif
  59. #endif
  60.  
  61.     _cursvar.echo = FALSE;
  62.     return( OK );
  63. }
  64.